//
//  UIView+SafeBoundary.m
//  mobile
//
//  Created by abc on 2019/1/14.
//  Copyright © 2019 azazie. All rights reserved.
//

#import "UIView+SafeBoundary.h"

@implementation UIView (SafeBoundary)

- (MASViewAttribute *)top {
    if(@available(iOS 11.0, *))
    {
        return self.mas_safeAreaLayoutGuideTop;
    }
    else
    {
        return self.mas_top;
    }
}

- (MASViewAttribute *)left {
    if(@available(iOS 11.0, *))
    {
        return self.mas_safeAreaLayoutGuideLeft;
    }
    else
    {
        return self.mas_left;
    }
}

- (MASViewAttribute *)bottom {
    if(@available(iOS 11.0, *))
    {
        return self.mas_safeAreaLayoutGuideBottom;
    }
    else
    {
        return self.mas_bottom;
    }
}

- (MASViewAttribute *)right {
    if(@available(iOS 11.0, *))
    {
        return self.mas_safeAreaLayoutGuideRight;
    }
    else
    {
        return self.mas_right;
    }
}

- (CGFloat)safeBottonDistance {
    CGFloat safeBottonDistance = 0.f;
    if (@available(iOS 11.0, *)) {
        safeBottonDistance = [[[UIApplication sharedApplication] delegate] window].safeAreaInsets.bottom;
    }
    return safeBottonDistance;
}

@end
